<?php

use App\Models\Group;
use Db\Types\CharType;
use Doctrine\DBAL\Types\Type;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class AlterNameToGroupTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {

//        Type::addType('char', 'App\Db\Types\CharType');
//        $model = new Group();
//        $table = $model->getConnection()->getTablePrefix() . $model->getTable();
//        $schema = $model->getConnection()->getDoctrineSchemaManager($table);
//        dd($schema);
//        $databasePlatform = $schema->getDatabasePlatform()->registerDoctrineTypeMapping('char', 'char');
        $types = Type::getTypesMap();
        dd($types);
        Schema::table('group', function (Blueprint $table) {
            $table->char('name', 20)->change()->comment('名称');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('group', function (Blueprint $table) {
            //
        });
    }
}
